<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <!-- CSS goes in the document HEAD or added to your external stylesheet -->
    <style type="text/css">
        table.gridtable {
            font-family: verdana,arial,sans-serif;
            font-size:11px;
            color:#333333;
            border-width: 1px;
            border-color: #666666;
            border-collapse: collapse;
        }
        table.gridtable th {
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #666666;
            background-color: #dedede;
        }
        table.gridtable td {
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #666666;
            background-color: #ffffff;
        }
    </style>

</head>
<body>
<div id="main" style="width:960px; margin: 0 auto;">

<?php echo form_open('weibo_fetch/sina_fetch/weibo_comm_page'); ?>
<table width="550">
    <tr>
        <td colspan="2">根据新浪微博url获取微博信息</td>
    </tr>
    <tr>
        <td class="itemName"><label name="url">微博列表：</label></td>
        <td><textarea name="urls" id="urls" cols="50" rows="10"><?= $urls?></textarea></td>
    </tr>

    <tr>
        <td colspan="2"><input type="submit" value="submit" name="sub"/></td>
    </tr>
</table>
</form>

<hr>
<div id="show_weibos" style="">
    <?php if(!empty($weibo_tree)):?>
        <?php foreach($weibo_tree as $weibo){ ?>
            <h2>url: <?= $weibo['url']?></h2>
            <!-- Table goes in the document BODY -->

            <h3>微博信息</h3>
            <table class="gridtable">
                <tr>
                    <th>博主</th>
                    <th>粉丝数量</th>
                    <th>微博创建时间</th>
                    <th>源</th>
                    <th>全文</th>
                    <th>转发</th>
                    <th>评论</th>
                    <th>点赞</th>
                </tr>
                <tr>
                    <td><a href="<?= 'weibo.com'.$weibo['weibo_info']->mblog->user->profile_url ?>"><?= $weibo['weibo_info']->mblog->user->screen_name ?><a></a></td>
                    <td><?= $weibo['weibo_info']->mblog->user->fansNum ?></td>
                    <td><?= $weibo['weibo_info']->mblog->created_at ?></td>
                    <td><?= $weibo['weibo_info']->mblog->source ?></td>
                    <td><?= $weibo['weibo_info']->mblog->text ?></td>
                    <td><?= $weibo['weibo_info']->mblog->reposts_count ?></td>
                    <td><?= $weibo['weibo_info']->mblog->comments_count ?></td>
                    <td><?= $weibo['weibo_info']->mblog->attitudes_count ?></td>
                </tr>
            </table>

            <h3>评论列表</h3>
            <table class="gridtable">
                <tr>
                    <th>全文</th>
                    <th>id</th>
                    <th>评论时间</th>
                    <th>评论源</th>
                    <th>作者</th>
                    <th>点赞</th>
                </tr>
                <?php foreach($weibo['comm'][0]->card_group as $comm){?>
                    <tr>
                        <td><?= $comm->text ?></td>
                        <td><?= $comm->id ?></td>
                        <td><?= $comm->created_at ?></td>
                        <td><?= $comm->source ?></td>
                        <td><a href="http://weibo.com<?= $comm->user->profile_url ?>"><?= $comm->user->screen_name ?></a></td>
                        <td><?= $comm->like_counts ?></td>
                    </tr>
                <?php } ?>

                <?php if(!empty($weibo['comm'][2])){?>
                    <tr>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th></th>
                    </tr>
                    <?php foreach($weibo['comm'][2]->card_group as $comm){?>
                    <tr>
                        <td><?= $comm->text ?></td>
                        <td><?= $comm->id ?></td>
                        <td><?= $comm->created_at ?></td>
                        <td><?= $comm->source ?></td>
                        <td><a href="http://weibo.com<?= $comm->user->profile_url ?>"><?= $comm->user->screen_name ?></a></td>
                        <td><?= $comm->like_counts ?></td>
                    </tr>
                <?php } ?>
                <?php } ?>
            </table>

            <br>
            <hr>
        <?php } ?>
    <?php endif;?>
</div>
</div>
</body>
</html>